<template>
	<div class="allcontainer" v-loading="loading">
		<div class="h2">未签到人员</div>
		<div class="bg-white">
			<div class="table">
				<el-table ref="singleTable" :data="data" stripe highlight-current-row style="width: 100%">
					<el-table-column type="index" label="序号" width="60" fixed="left" align="center"></el-table-column>
					<el-table-column prop="Name" label="姓名" min-width="100" fixed="left" align="center">
						<template slot-scope="scope">
							<div>
								{{ scope.row.Name | testname }}
								<a-icon v-if="scope.row.Sex==2" style="color: deeppink;" type="woman" />
								<a-icon v-else style="color: #1890FF;" type="man" />
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="UserNo" label="学号" min-width="140" align="center">
						<template slot-scope="scope">
							{{ scope.row.UserNo | testno }}
						</template>
					</el-table-column>
					<el-table-column prop="TypeName" label="类型" min-width="140" align="center"></el-table-column>
					<el-table-column prop="AddTime" label="加入时间" min-width="120" align="center"></el-table-column>
					<el-table-column label="操作" width="120" v-if="$route.query.State!=4&&$route.query.State!=5">
						<template slot-scope="scope">
							<div class="user-btn user-btn-auto">
								<span class="signin" @click="setSign(scope.row)">签到</span>
							</div>
						</template>
					</el-table-column>
				</el-table>
				<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
					:current-page="pagination.currentPage" :page-sizes="pagination.pageSizeOptions"
					:page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper"
					:total="pagination.total"></el-pagination>
			</div>
		</div>
	</div>
</template>

<script>
	import Func from '@/utils/func';
	import {
		UserNoSignUserPageList,
		UserActivityMemberDoSign
	} from '@/api/follow';
	const data = [];
	export default {
		components: {},
		data() {
			return {
				data,
				form: this.$form.createForm(this, {
					name: 'advanced_search'
				}),
				pagination: {
					currentPage: 1,
					pageSize: this.global.pageSize,
					pageSizeOptions: this.global.pageSizeOptions, // 每页中显示的数据
					showTotal: total => `共有 ${total} 条数据` // 分页中显示总的数据
				},
				TypeList: [{
						ID: 'null',
						Name: '待审核'
					},
					{
						ID: 'true',
						Name: '审核通过'
					},
					{
						ID: 'false',
						Name: '审核未通过'
					}
				],
				addIf: false,
				text: {},
				visible: false,
				confirmLoading: false,
				itemId: '',
				departmentList: [],
				worklist: [],
				loading: false,
				values: {},
				pages: {
					pageIndex: 1,
					pageSize: 20
				},
				tableHeight: parseFloat(window.innerHeight - 160),
				TypeIDList: [],
				DepartCodeList: [],
				ProjectIDList: [],
				ishaveid: true,
				selectList: {},
				showModal: false
			};
		},
		computed: {},
		created() {
			this.getList();
		},
		mounted() {},
		methods: {
			async setSign(text) {
				let that = this;
				this.$confirm({
					title: '提示',
					content: `您确定要给该成员签到吗？`,
					okText: '确认',
					cancelText: '取消',
					async onOk() {
						let data = {};
						data.activityMemberID = text.ID
						data.activitySignID = that.$route.query.ID
						let res = await UserActivityMemberDoSign(data);
						if (res.data.code == 0) {
							that.$message.success(res.data.msg)
							that.getList()
						} else {
							that.$message.error(res.data.msg)
						}
					}
				});
			},
			handleSizeChange(val) {
				this.pagination.pageSize = val;
				this.getList()
			},
			handleCurrentChange(val) {
				this.pagination.currentPage = val;
				this.getList()
			},
			async getList() {
				this.loading = true;
				let data = {};
				if (this.values) {
					data = this.values;
				}
				data.pageIndex = this.pagination.currentPage;
				data.pageSize = this.pagination.pageSize;
				data.id = this.$route.query.ID
				let res = await UserNoSignUserPageList(data);
				this.loading = false;
				this.data = res.data.data;
				const pagination = {
					...this.pagination
				};
				pagination.total = res.data.pageInfo.TotalItemCount;
				this.pagination = pagination;
			},
			closeFun(index) {
				this.showModal = false
				this.getList()
			},
		}
	};
</script>

